<?php
session_start();
ini_set("include_path", "/");
require_once 'ClsSebent/Product_class.php';//C:/Program Files/EasyPHP 2.0b1/www/SebentLastCode

$_SESSION['USERTYPE']='buyer';
$_SESSION['SITE_ID']=101;

	$Product= new Product_class;
	
if(isset($_POST['btn_add']) && $_POST['btn_add']!='' && $_SESSION['USERTYPE']!='' && $_SESSION['SITE_ID']!='')
{
//	$Product-> $id=;
//	$Product-> $Product_id;
	$Product-> Site_id= $_SESSION['SITE_ID'];
	$Product-> Product_title=$_POST['Product_title'];
	$Product-> Product_price=$_POST['Product_price'];
	//$Product-> Product_finalprice=$_POST['Product_finalprice'];
	$Product-> Tax_on=($_POST['Tax_on']=='Y')?'Y':'N';
	$Product-> Tax_amt=($_POST['Tax_on']=='Y')?$_POST['Tax_amt']:0;
	$Product-> Profit_on=($_POST['Profit_on']=='Y')?'Y':'N';
	$Product-> Profit_amt=($_POST['Profit_on']=='Y')?$_POST['Profit_amt']:0;
	$Product-> Shipping_amt=($_POST['Shipping_amt']=="")?0:$_POST['Shipping_amt'];
	$Product-> Product_cat=$_POST['Product_cat'];
	$Product-> Product_desc=$_POST['Product_desc'];
	$Product-> Product_size=$_POST['Product_size'];
	$Product-> Product_color=$_POST['Product_color'];
	$Product-> Product_imgurl=$_FILES['Product_imgurl']['tmp_name'];
	$Product-> Product_imgalt=$_POST['Product_imgalt'];	
	//*******************************
	$Product-> addonFileName=$_FILES['addonFileName']['tmp_name'];
	$Product-> lotpriceFileName=$_FILES['lotpriceFileName']['tmp_name'];		
	$Product->Add_Product();
}

if(isset($_POST['btn_cancel']))
{
	
}
?>

<script src="ClsSebent/Client_Validation.js" type="text/javascript"></script>
<form action="add_product.php" method="post" enctype="multipart/form-data">
<table width="100%" border="1">
  <tr>
    <td colspan="3"><div align="center"><strong>Add Product </strong></div></td>
  </tr>
  <tr>
    <td colspan="3"><div id="divMessage" align="center"><?php echo "<h2><font color='red'>".$Product-> Message."</font></h2>";?></div></td>
  </tr>
  <tr>
    <td width="23%">Choose Category </td>
    <td colspan="2">
	<select name="Product_cat">
	<?php $Product->Load_categories(); ?>
    </select></td>
  </tr>
  <tr>
    <td>Product Name </td>
    <td colspan="2"><input type="text" id="Product_title" name="Product_title"></td>
  </tr>
  <tr>
    <td>Product Description </td>
    <td colspan="2"><textarea id="Product_desc" name="Product_desc" cols="30" rows="5"></textarea></td>
  </tr>
  <tr>
    <td>Price</td>
    <td colspan="2"><input type="text" name="Product_price" id="Product_price"></td>
  </tr>
  <tr>
    <td>Profit % </td>
    <td width="31%"><input type="text" name="Profit_amt" id="Profit_amt"></td>
    <td width="46%"><input type="checkbox" name="Profit_on" value="Y" id="Profit_on">
      Apply Profit </td>
  </tr>
  <tr>
    <td>Tax % </td>
    <td><input type="text" name="Tax_amt" id="Tax_amt"></td>
    <td><input type="checkbox" name="Tax_on" value="Y" id="Tax_on">
      Apply Tax </td>
  </tr>
  <tr>
    <td>Shipping</td>
		<td colspan="2"><input type="text" name="Shipping_amt" id="Shipping_amt"></td>
  </tr>
  <tr>
    <td>Size</td>
    <td colspan="2"><input type="text" name="Product_size" id="Product_size"></td>
  </tr>
  <tr>
    <td>Color</td>
    <td colspan="2"><input type="text" name="Product_color" id="Product_color"></td>
  </tr>
  <tr>
    <td>Image</td>
    <td colspan="2"><input type="file" name="Product_imgurl" id="Product_imgurl"></td>
  </tr>
  <tr>
    <td>Image Alt</td>
    <td colspan="2"><input type="text" name="Product_imgalt" ></td>
  </tr>
  <tr>
    <td>Add On List </td>
    <td colspan="2"><input type="file" name="addonFileName" ></td>
  </tr>
  <tr>
    <td>Lot Pricing List </td>
    <td colspan="2"><input type="file" name="lotpriceFileName"></td>
  </tr>
  <tr>
    <td colspan="3"><div align="center">
      <input type="submit" name="btn_add" value="Add Product" onClick="Javascript: return validate_addProduct()">
       <input type="submit" name="btn_cancel" value="Cancel">
    </div></td>
  </tr>  
</table>
</form>
